<template>
  <div>
    <!-- 爆款热卖  头部导航 -->
    <div class="solve-fixed">
      <nut-navbar
        @on-click-back="back"
        title="爆款热卖"
        class="header"
      ></nut-navbar>
    </div>
    <!-- 爆款热卖 商品卡片 -->
    <div
      class="productCard"
      v-for="item in this.goodsList"
      :key="item.id"
    >
      <img
        :src="item.s_goods_photos[0].path"
        alt=""
      >
      <div class="productCard-text">
        <div class="text-head">
          <h3>{{item.name}}</h3>
          <p>233人已收藏</p>
        </div>
        <div class="text-footer">
          <div class="price-button">
            <h3>{{"¥ "+item.price}}</h3>
            <router-link to="/GoodsDetails">
              <button>马上抢</button>
            </router-link>
          </div>
          <div class="price-sell">
            <p>￥2333</p>
            <h3>已售2333件</h3>
          </div>
        </div>

      </div>
    </div>
  </div>
</template>

<script>
import { mapState } from 'vuex'
export default {
  data () {
    return {
      state: [{
        imgUrl: '123',
        title: 'OMINI简约及黑色上衣T恤',
        price: '123'
      }]
    }
  },
  methods: {
    back () {
      this.$router.push('/home/homeindex')
    }
  },
  computed: {
    ...mapState(['goodsList'])
  },
}
</script>

<style lang="scss" scoped>
* {
  margin: 0;
  padding: 0;
}
::v-deep .header {
  width: 100vw;
  background-color: #eae9e5;
  position: fixed;
  z-index: 999;
}
.solve-fixed {
  height: 44px;
  z-index: -999;
}
// 商品卡片样式
.productCard {
  width: 90vw;
  height: 120px;
  margin: 20px auto 0;
  display: flex;
  border-radius: 3px;
  overflow: hidden;
  box-shadow: rgba(0, 0, 0, 0.35) 0px 5px 15px;
  z-index: -100;
  img {
    width: 120px;
    height: 120px;
    border-radius: 3px;
    background-color: aliceblue;
  }
  .productCard-text {
    width: 225px;
    height: 120px;
    padding: 8px;
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    .text-head {
      h3 {
        font-weight: 400;
        font-style: normal;
        font-size: 14px;
        text-align: left;
        line-height: 20px;
        /* 超出范围隐藏 */
        overflow: hidden;
        /* 文字超出用省略号 */
        text-overflow: ellipsis;
        /* 盒子模型 */
        display: -webkit-box;
        /* 显示的文本行数 */
        -webkit-line-clamp: 2;
        /* 子元素的垂直排列方式 */
        -webkit-box-orient: vertical;
      }
      p {
        font-weight: 400;
        font-style: normal;
        font-size: 12px;
        color: rgb(102, 102, 102);
        text-align: left;
        line-height: 20px;
      }
    }
    .text-footer {
      .price-button {
        display: flex;
        justify-content: space-between;
        align-items: center;
        margin-bottom: 5px;
        h3 {
          font-weight: 700;
          font-style: normal;
          font-size: 18px;
          color: rgb(209, 8, 42);
          text-align: left;
          line-height: 16px;
        }
        button {
          width: 60px;
          height: 24px;
          background-color: rgb(209, 8, 42);
          border: none;
          border-radius: 4px;
          box-shadow: none;
          font-weight: 400;
          font-size: 12px;
          color: rgb(255, 255, 255);
        }
      }
      .price-sell {
        display: flex;
        justify-content: space-between;
        text-align: center;
        p {
          font-weight: 400;
          text-decoration: line-through;
          font-size: 12px;
          color: rgb(153, 153, 153);
          text-align: left;
          line-height: 16px;
        }
        h3 {
          font-weight: 400;
          font-size: 12px;
          color: rgb(153, 153, 153);
          text-align: left;
          line-height: 16px;
        }
      }
    }
  }
}
</style>